#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <stdlib.h>

int main()
{
    pid_t pid;
    char* message;
    int n;

    pid = fork();
    if(pid < 0) {
        perror("fork error: ");
        exit(1);
    }
    
    if(0 == pid) {
        message = "This is the child\n";
        n = 6;
    } else {
        message = "This is the parent\n";
        n = 3;
    }

    for(; n > 0; n--) {
        printf("%s\n", message);
        sleep(1);
    }

    return 0;
}

